package com.zsk.shop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zsk.shop.entity.DeliveryAddressStatus;
import com.zsk.shop.model.results.PackageResult;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DeliveryAddressStatusMapper extends BaseMapper<DeliveryAddressStatus> {
    int deleteByPrimaryKey(Long id);

    int insertSelective(DeliveryAddressStatus record);

    DeliveryAddressStatus selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(DeliveryAddressStatus record);

    int updateByPrimaryKey(DeliveryAddressStatus record);

    /**
     * 列表
     * @param orderNo
     * @return
     */
    @Select("SELECT * FROM shop_delivery_address_status WHERE order_no=#{orderNo} ORDER BY create_time ASC")
    List<PackageResult> getPackageList(@Param("orderNo") String orderNo);

    /**
     * 获取总数
     * @param orderNo
     * @return
     */
    @Select("SELECT COUNT(1) FROM shop_delivery_address_status WHERE order_no=#{orderNo}")
    int getCount(@Param("orderNo") String orderNo);
}